import {
  IsNotEmpty,
  IsString,
  MinLength,
  IsEmail,
  IsOptional,
  IsPhoneNumber,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class RegisterDto {
  @ApiProperty({
    description: 'Username',
    example: 'username123',
  })
  @IsNotEmpty()
  @IsString()
  username: string;

  @ApiProperty({
    description: 'Password (minimum 6 characters)',
    example: 'Password123',
    minLength: 6,
  })
  @IsNotEmpty()
  @IsString()
  @MinLength(6, { message: 'Password must be at least 6 characters long' })
  password: string;

  @ApiProperty({
    description: 'Device serial number',
    example: 'DEVICE-123456',
  })
  @IsOptional()
  @IsString()
  deviceSerialNumber?: string;

  @ApiProperty({
    description: 'Unique device identifier (deprecated, use deviceSerialNumber instead)',
    example: 'device-123456',
    deprecated: true,
  })
  @IsOptional()
  @IsString()
  deviceId?: string;

  @ApiProperty({
    description: 'User display name',
    example: 'John Doe',
    required: false,
  })
  @IsOptional()
  @IsString()
  displayName?: string;

  @ApiProperty({
    description: 'User phone number (Chinese format)',
    example: '13812345678',
    required: false,
  })
  @IsOptional()
  @IsPhoneNumber('CN')
  phone?: string;
}
